package com.xdjd.task.service.daoservice;


import com.xdjd.task.mapper.member.MemberUserPoDao;
import com.xdjd.task.model.member.MemberUserPo;
import net.oschina.durcframework.easymybatis.query.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * Created by Administrator on 2019/1/9 0009.
 */
@Service
public class MemberUserPoService {

    @Autowired
    private MemberUserPoDao memberUserPoDao;

    public void saveMember(MemberUserPo po) {
        po.setCreateTime(new Date());
        po.setModifyTime(new Date());
        memberUserPoDao.save(po);
    }

    public MemberUserPo getMemberByAccount(String account) {
        Query query = new Query().eq("account", account);
        return memberUserPoDao.getByExpression(query);
    }

    public void updateMember(MemberUserPo po) {
        po.setModifyTime(new Date());
        memberUserPoDao.update(po);
    }

    public MemberUserPo getMemberById(Long memberId) {
        return memberUserPoDao.get(memberId);
    }

    public List<MemberUserPo> findAllUser() {
        return memberUserPoDao.findAll(new Query());
    }
}
